import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $Lazy } = window
// ===================================================================== Lazy
const Export 	= $Lazy.file(()=>import('#private/common/export'))
const $time 	= $Lazy.file(()=>import('@com/utils/time'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		// 提交表单列表
		formData:[
			{ label: '开始时间',	name: 'start_at', 	type: 'date-time', required:true, half:true },
			{ label: '结束时间',	name: 'end_at', 	type: 'date-time', required:true, half:true },
		]
	}
	
	model = {}
	
	open = rows => {
		this.rows = rows
		this.modal.open({ formRef:this.formRef })
	}
	
	render(){
		return FormModal.call(this,{ title:'导出外包单位数据',
			onForm: ref => {
				$time.then(f=>{
					const arr = f.duration['1-9-9']()
					ref.setValue({ start_at:arr[0], end_at:arr[1] })
				})
			},
			onSubmit: param =>{
				Export.then(f => f('lis-outsourcing-company/exportData',{ type:'post', query:() => ({ ...this.rows,  ...param, _id:0, is_checked:false }) }))
			},
		})
	}
}

export default Index